<template>
  <div class="photoList-box">
    <div id="slider" class="mui-slider">
      <div
        class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted"
      >
        <div class="mui-scroll">
          <a
            :class="['mui-control-item',item.id == 14? 'mui-active':''] "
            v-for="item in titleList"
            :key="item.id"
            @click="getPhoto(item.id)"
          >{{ item.title }}</a>
        </div>
      </div>
    </div>

    <!-- 内容 -->
    <div class="photoList-comtent">
      <div class="img" v-for="item in imgList" :key="item.id">
        <img :src="item.img_url" alt>
        <div class="bottom_box">
          <p class="title">{{ item.title }}</p>
          <p class="zhaiyao">{{ item.zhaiyao }}</p>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import mui from "../../../lib/js/mui.min.js";
mui(".mui-scroll-wrapper").scroll({
  deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
});
export default {
  data() {
    return {
      titleList: [],
      imgList: []
    };
  },
  created() {
    this.getTitle();
    this.getPhoto();
  },
  methods: {
    getTitle() {
      this.$http.get("api/getimgcategory").then(res => {
        console.log(res.body.message);
        this.titleList = res.body.message;
      });
    },
    getPhoto(id) {
      this.$http.get("api/getimages/" + id).then(res => {
        console.log(res.body.message);
        this.imgList = res.body.message;
      });
    }
  }
};
</script>
<style lang="less">
* {
  touch-action: pan-y;
}
.img {
  position: relative;
  width: 100%;
  img {
    width: 100%;
    height: 100%;
  }
  .bottom_box {
    height: 140px;
    width: 100%;
    background-color: rgba(0, 0, 0, .4);
    position: absolute;
    bottom: 0px;
    margin: 0px;
    .title {
      color: #fff;
      font-size: 14px;
    }
    .zhaiyao {
      color: #fff;
      font-size: 12px;
    }
  }
}
</style>